package com.hmall.common.mq.handler;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.springframework.amqp.AmqpException;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessagePostProcessor;

@AllArgsConstructor
@NoArgsConstructor
public class DelayMessagePostProcessor implements MessagePostProcessor {
    private Integer delayTime;

    @Override
    public Message postProcessMessage(Message message) throws AmqpException {
        message.getMessageProperties().setDelay(delayTime);
        return message;
    }
}
